using System;
using Code.Core.StateMachine;

namespace Code.GameLogic.XianJian.XianJianBehavior
{
    public class BehaviorLoader
    {
        public static State<XianJianFms> InitXianJianBehaviorForCode(string xianJianBehaviorCode)
        {
            Type type = Type.GetType(xianJianBehaviorCode);

            if (type != null && typeof(State<XianJianFms>).IsAssignableFrom(type))
            {
                object instance = Activator.CreateInstance(type);
                var behavior = (State<XianJianFms>)instance;
                return behavior;
            }
            return null;
        }
    }
}